<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>PaleGem: Inc/pgRender.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">PaleGem
   &#160;<span id="projectnumber">0.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_f93dfce691d792349f1c14ede440e2e6.html">Inc</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">pgRender.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="pg_render_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include&quot;<a class="code" href="_pale_gem_8h.html">PaleGem.h</a>&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include&lt;xnamath.h&gt;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include&lt;d3dcompiler.h&gt;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include&quot;<a class="code" href="pg_vertex_shader_8h.html">pgVertexShader.h</a>&quot;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include&quot;<a class="code" href="pg_pixel_shader_8h.html">pgPixelShader.h</a>&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include&lt;map&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include&quot;<a class="code" href="pg_renderable_object_8h.html">pgRenderableObject.h</a>&quot;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div>
<div class="line"><a name="l00012"></a><span class="lineno"><a class="code" href="pg_render_8h.html#ad28e8eba5bcef99961000babe10cfb44">   12</a></span>&#160;<span class="preprocessor">#define g_PG_pRenderer g_PG_pPaleGemFramework-&gt;GetRenderer()</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00014"></a><span class="lineno"><a class="code" href="struct_constant_buffer.html">   14</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_constant_buffer.html">ConstantBuffer</a></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;{</div>
<div class="line"><a name="l00016"></a><span class="lineno"><a class="code" href="struct_constant_buffer.html#a49314046536952bad77afbf51b583d25">   16</a></span>&#160;    XMMATRIX <a class="code" href="struct_constant_buffer.html#a49314046536952bad77afbf51b583d25">mWorld</a>;</div>
<div class="line"><a name="l00017"></a><span class="lineno"><a class="code" href="struct_constant_buffer.html#a030700876c683b8d01f6d435b300ed8a">   17</a></span>&#160;    XMMATRIX <a class="code" href="struct_constant_buffer.html#a030700876c683b8d01f6d435b300ed8a">mView</a>;</div>
<div class="line"><a name="l00018"></a><span class="lineno"><a class="code" href="struct_constant_buffer.html#a9f9e424dd58d6a5c0545ed415e0e8340">   18</a></span>&#160;    XMMATRIX <a class="code" href="struct_constant_buffer.html#a9f9e424dd58d6a5c0545ed415e0e8340">mProjection</a>;</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;};</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">/* </span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">pgRenderer</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">Basic class for DirectX 11 renderer</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="code" href="classpg_render.html">   25</a></span>&#160;<span class="keyword">class </span><a class="code" href="_pale_gem_8h.html#ab5e0a0a7e1c934d91f3c922b909c07e7">PALEGEM_API</a> <a class="code" href="classpg_render.html">pgRender</a> : <span class="keyword">public</span> <a class="code" href="class_i_event_listener.html" title="Holds the OnEvent function.">IEventListener</a></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;{</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <span class="keyword">public</span>:</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    <a class="code" href="classpg_render.html">pgRender</a>();</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    ~<a class="code" href="classpg_render.html">pgRender</a>();</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    </div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="comment">// Initializes DirectX</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    HRESULT Init();                 </div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    HRESULT Release();              <span class="comment">//Cleans up all memory used by DirectX itself</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <span class="keywordtype">void</span>    Render();               <span class="comment">//Renders a scene</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="code" href="classpg_render.html#a5650620621116dbd5dfc4b3486c635c7">   38</a></span>&#160;    ID3D11Device            *<a class="code" href="classpg_render.html#a5650620621116dbd5dfc4b3486c635c7">m_pd3dDevice</a>;          <span class="comment">// D3D11 device</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="code" href="classpg_render.html#ab7749c5bee461407c802e4b82d0001aa">   39</a></span>&#160;    ID3D11DeviceContext     *<a class="code" href="classpg_render.html#ab7749c5bee461407c802e4b82d0001aa">m_pImmediateContext</a>;   <span class="comment">// Device Context</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="code" href="classpg_render.html#a783f2ffff5a9eb2903a4c7cb8779820a">   40</a></span>&#160;    ID3D11RenderTargetView  *<a class="code" href="classpg_render.html#a783f2ffff5a9eb2903a4c7cb8779820a">m_pRenderTargetView</a>;   <span class="comment">// Target view</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="code" href="classpg_render.html#a2b6b17e22fa219090414fa06487b94bd">   41</a></span>&#160;    ID3D11RasterizerState   *<a class="code" href="classpg_render.html#a2b6b17e22fa219090414fa06487b94bd">m_pRasterState</a>;</div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="code" href="classpg_render.html#aa4381e0702a80082b82f11f191f69513">   42</a></span>&#160;    XMMATRIX <a class="code" href="classpg_render.html#aa4381e0702a80082b82f11f191f69513">m_projectionMatrix</a>;</div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="code" href="classpg_render.html#a88c0536eb0c16cfd5c111b3db636c5d7">   43</a></span>&#160;    XMMATRIX <a class="code" href="classpg_render.html#a88c0536eb0c16cfd5c111b3db636c5d7">m_viewMatrix</a>;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_i_event_listener.html#a40210b0cc287ec611c2e05eebb8964aa" title="Called by the event manager.">OnEvent</a>(<a class="code" href="struct_i_event.html" title="Event structure.">IEvent</a> *eEvent);</div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="code" href="classpg_render.html#a8975e9b788eaa5a1e4996eed4d3519ba">   46</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classpg_render.html#a8975e9b788eaa5a1e4996eed4d3519ba">IsInitialized</a>(){<span class="keywordflow">return</span> m_bIsInitialized;}</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="code" href="classpg_render.html#ae08925d44769225a924842851114d80c">   48</a></span>&#160;    <a class="code" href="classpg_vertex_shader.html">pgVertexShader</a> <a class="code" href="classpg_render.html#ae08925d44769225a924842851114d80c">GetVertexShader</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> idx) {<span class="keywordflow">return</span> m_apVertexShaders[idx];}</div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="code" href="classpg_render.html#a052b98c44507342664170ab466e2f386">   49</a></span>&#160;    <a class="code" href="classpg_pixel_shader.html">pgPixelShader</a> <a class="code" href="classpg_render.html#a052b98c44507342664170ab466e2f386">GetPixelShader</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> idx) {<span class="keywordflow">return</span> m_apPixelShaders[idx];}</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetIndexOfPixelShader(<span class="keyword">const</span> <span class="keywordtype">char</span>* szName);</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetIndexOfVertexShader(<span class="keyword">const</span> <span class="keywordtype">char</span>* szName);</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="keywordtype">void</span> AddRenderNode(<a class="code" href="class_i_renderable_object.html" title="Renderable objects interface.">IRenderableObject</a> *pNode);</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="comment">//DirectX init vars</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"><a class="code" href="classpg_render.html#a57cfbc8aa6e25f5dd4c3b76f9eb4922e">   58</a></span>&#160;    IDXGISwapChain          *<a class="code" href="classpg_render.html#a57cfbc8aa6e25f5dd4c3b76f9eb4922e">m_pSwapChain</a>;          <span class="comment">// BackBuffer swapchain</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    </div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="code" href="classpg_render.html#ab48cdeee9676760de5b8c5b754fbc234">   60</a></span>&#160;    D3D_DRIVER_TYPE         <a class="code" href="classpg_render.html#ab48cdeee9676760de5b8c5b754fbc234">m_driverType</a>;           <span class="comment">// Hardware, Software or Reference driver</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="code" href="classpg_render.html#adb9774e727bda6aba742487b6aa0a8e7">   61</a></span>&#160;    D3D_FEATURE_LEVEL       <a class="code" href="classpg_render.html#adb9774e727bda6aba742487b6aa0a8e7">m_featureLevel</a>;         <span class="comment">// DX 9.1 - 11.0</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="code" href="classpg_render.html#a3d6ad177626745bb6bc25c4b1c074fef">   62</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classpg_render.html#a3d6ad177626745bb6bc25c4b1c074fef">m_bIsInitialized</a>;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    <span class="keywordtype">bool</span> InitShaders();</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <span class="keywordtype">void</span> ReleaseShaders();</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    </div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div>
<div class="line"><a name="l00069"></a><span class="lineno"><a class="code" href="classpg_render.html#a3a981f490a65896731d362bdae9f75cd">   69</a></span>&#160;    <a class="code" href="classpg_vertex_shader.html">pgVertexShader</a> *<a class="code" href="classpg_render.html#a3a981f490a65896731d362bdae9f75cd">m_apVertexShaders</a>;</div>
<div class="line"><a name="l00070"></a><span class="lineno"><a class="code" href="classpg_render.html#a05363cbe468116125d48f76f0273360f">   70</a></span>&#160;    <a class="code" href="classpg_pixel_shader.html">pgPixelShader</a> *<a class="code" href="classpg_render.html#a05363cbe468116125d48f76f0273360f">m_apPixelShaders</a>;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="code" href="classpg_render.html#ace2b2caa47bcb81050f5af6e9c703ef8">   72</a></span>&#160;    std::map&lt;const char*, unsigned int&gt; *<a class="code" href="classpg_render.html#ace2b2caa47bcb81050f5af6e9c703ef8">m_pVertexMap</a>;</div>
<div class="line"><a name="l00073"></a><span class="lineno"><a class="code" href="classpg_render.html#a2ea9f864c10a64512dfbb067011cd395">   73</a></span>&#160;    std::map&lt;const char*, unsigned int&gt; *<a class="code" href="classpg_render.html#a2ea9f864c10a64512dfbb067011cd395">m_pPixelMap</a>;</div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="code" href="classpg_render.html#aecaccc398d96efe2f7749209444fdebd">   74</a></span>&#160;    std::pair&lt;const char*,unsigned int&gt; <a class="code" href="classpg_render.html#aecaccc398d96efe2f7749209444fdebd">m_charIntPair</a>;</div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="code" href="classpg_render.html#aa284584760f011b630bf09e841fc5c00">   75</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classpg_render.html#aa284584760f011b630bf09e841fc5c00">m_nPixelShaderCount</a>;</div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="code" href="classpg_render.html#adceb0eec78860709f7b4a587c72ce70f">   76</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classpg_render.html#adceb0eec78860709f7b4a587c72ce70f">m_nVertexShaderCount</a>;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div>
<div class="line"><a name="l00078"></a><span class="lineno"><a class="code" href="classpg_render.html#ae6c87499bdc290dd68605934361ec49b">   78</a></span>&#160;    std::list&lt;IRenderableObject*&gt; <a class="code" href="classpg_render.html#ae6c87499bdc290dd68605934361ec49b">m_renderNodes</a>;</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;};</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Mar 1 2013 11:55:07 for PaleGem by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3.1
</small></address>
</body>
</html>
